<?php

/**
 * Comercio filter form base class.
 *
 * @package    MercaderDigital
 * @subpackage filter
 * @author     Germán Figueredo
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseComercioFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'NomComercio'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'Calle'          => new sfWidgetFormFilterInput(),
      'Numero'         => new sfWidgetFormFilterInput(),
      'Barrio'         => new sfWidgetFormFilterInput(),
      'Distrito'       => new sfWidgetFormFilterInput(),
      'Detalles'       => new sfWidgetFormFilterInput(),
      'ID_Comerciante' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fechaEvento'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'Evento'         => new sfWidgetFormFilterInput(),
      'id_user_ev'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('UsuarioEvento'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'NomComercio'    => new sfValidatorPass(array('required' => false)),
      'Calle'          => new sfValidatorPass(array('required' => false)),
      'Numero'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'Barrio'         => new sfValidatorPass(array('required' => false)),
      'Distrito'       => new sfValidatorPass(array('required' => false)),
      'Detalles'       => new sfValidatorPass(array('required' => false)),
      'ID_Comerciante' => new sfValidatorPass(array('required' => false)),
      'fechaEvento'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'Evento'         => new sfValidatorPass(array('required' => false)),
      'id_user_ev'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('UsuarioEvento'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('comercio_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Comercio';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Text',
      'NomComercio'    => 'Text',
      'Calle'          => 'Text',
      'Numero'         => 'Number',
      'Barrio'         => 'Text',
      'Distrito'       => 'Text',
      'Detalles'       => 'Text',
      'ID_Comerciante' => 'Text',
      'fechaEvento'    => 'Date',
      'Evento'         => 'Text',
      'id_user_ev'     => 'ForeignKey',
    );
  }
}
